package cauca.scsn.modelo.entidad;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ModeloVehiculo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "modelo_vehiculo", schema = "public")
public class ModeloVehiculo extends EntidadGenerica {

	// Fields

	private Integer idModeloVehiculo;
	private TipoVehiculo tipoVehiculo;
	private MarcaVehiculo marcaVehiculo;
	private String nombre;
	private String descripcion;
	private Set<Vehiculo> vehiculos = new HashSet<Vehiculo>(0);

	// Constructors

	/** default constructor */
	public ModeloVehiculo() {
	}

	/** minimal constructor */
	public ModeloVehiculo(Integer idModeloVehiculo, TipoVehiculo tipoVehiculo,
			MarcaVehiculo marcaVehiculo, String nombre, String status) {
		this.idModeloVehiculo = idModeloVehiculo;
		this.tipoVehiculo = tipoVehiculo;
		this.marcaVehiculo = marcaVehiculo;
		this.nombre = nombre;
		this.status = status;
	}

	/** full constructor */
	public ModeloVehiculo(Integer idModeloVehiculo, TipoVehiculo tipoVehiculo,
			MarcaVehiculo marcaVehiculo, String nombre, String descripcion,
			String status, Set<Vehiculo> vehiculos) {
		this.idModeloVehiculo = idModeloVehiculo;
		this.tipoVehiculo = tipoVehiculo;
		this.marcaVehiculo = marcaVehiculo;
		this.nombre = nombre;
		this.descripcion = descripcion;
		this.status = status;
		this.vehiculos = vehiculos;
	}

	// Property accessors
	@Id
	@Column(name = "id_modelo_vehiculo", unique = true, nullable = false)
	public Integer getIdModeloVehiculo() {
		return this.idModeloVehiculo;
	}

	public void setIdModeloVehiculo(Integer idModeloVehiculo) {
		this.idModeloVehiculo = idModeloVehiculo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_tipo_vehiculo", nullable = false)
	public TipoVehiculo getTipoVehiculo() {
		return this.tipoVehiculo;
	}

	public void setTipoVehiculo(TipoVehiculo tipoVehiculo) {
		this.tipoVehiculo = tipoVehiculo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_marca_vehiculo", nullable = false)
	public MarcaVehiculo getMarcaVehiculo() {
		return this.marcaVehiculo;
	}

	public void setMarcaVehiculo(MarcaVehiculo marcaVehiculo) {
		this.marcaVehiculo = marcaVehiculo;
	}

	@Column(name = "nombre", nullable = false, length = 60)
	public String getNombre() {
		return this.nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	@Column(name = "descripcion")
	public String getDescripcion() {
		return this.descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	@Column(name = "status", nullable = false, length = 1)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "modeloVehiculo")
	public Set<Vehiculo> getVehiculos() {
		return this.vehiculos;
	}

	public void setVehiculos(Set<Vehiculo> vehiculos) {
		this.vehiculos = vehiculos;
	}

	@Override
	public Object getPrimaryKey() {
		return this.idModeloVehiculo;
	}

	@Override
	public String toString() {
		return null;
	}

}